/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * articulos_sie_almacen_movi_reclasifalta.java
 *
 * Created on 17/05/2014, 05:22:29 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;

import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTable.*;
import java.awt.*;
import java.text.*;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;


import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.RefineryUtilities;
/**
 *
 * @author michelle
 */
public class articulos_sie_almacen_movi_reclasifalta extends javax.swing.JFrame {

     private javax.swing.table.DefaultTableModel jtable_modelo_moviextra;
  private javax.swing.table.DefaultTableModel jtable_modelo_faltante;
    private javax.swing.table.DefaultTableModel jtable_modelo_sobrante;
     private javax.swing.table.DefaultTableModel jtable_modelo_moviextrab;

    bd_conexion x = new bd_conexion() ;
    ResultSet rs = null;
    int as=0,ad=0,opcionope=0,controlcombo=0;
    /** Creates new form articulos_sie_almacen_movi_reclasifalta */
    public articulos_sie_almacen_movi_reclasifalta() {
        this.iniciar_modelo_movimientoextra();
        this.iniciar_modelo_de_faltante();
        this.iniciar_modelo_de_sobrante();
        this.iniciar_modelo_movimientoextrabaja();
        initComponents();

        java.util.Date fechahoya=new Date();
        this.jdc_fechadocto.setDate(fechahoya);


            jt_foliosdetalle.getColumnModel().getColumn(0).setPreferredWidth(10);//id
            jt_foliosdetalle.getColumnModel().getColumn(1).setPreferredWidth(60);//clave
            jt_foliosdetalle.getColumnModel().getColumn(2).setPreferredWidth(50);//descripcion
            jt_foliosdetalle.getColumnModel().getColumn(3).setPreferredWidth(80);//precio
            jt_foliosdetalle.getColumnModel().getColumn(4).setPreferredWidth(10);//exis
            jt_foliosdetalle.getColumnModel().getColumn(5).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(6).setPreferredWidth(10);//id
            jt_foliosdetalle.getColumnModel().getColumn(7).setPreferredWidth(60);//clave
            jt_foliosdetalle.getColumnModel().getColumn(8).setPreferredWidth(50);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(9).setPreferredWidth(80);//precio
            jt_foliosdetalle.getColumnModel().getColumn(10).setPreferredWidth(10);//Exis
            jt_foliosdetalle.getColumnModel().getColumn(11).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(12).setPreferredWidth(10);//cantidad
            jt_foliosdetalle.getColumnModel().getColumn(13).setPreferredWidth(60);//observacion


        this.id_tienda.setText(String.valueOf(variables_global.getidtiendami()));
        this.id_tienda1.setText(variables_global.getcliente_tistribucion());
        this.loadcombo();
        controlcombo=1;
    }
    public articulos_sie_almacen_movi_reclasifalta(int opcion) {
        this.iniciar_modelo_movimientoextra();
        this.iniciar_modelo_de_faltante();
        this.iniciar_modelo_de_sobrante();
        this.iniciar_modelo_movimientoextrabaja();
        initComponents();

        java.util.Date fechahoya=new Date();
        this.jdc_fechadocto.setDate(fechahoya);
            jt_foliosdetalle.getColumnModel().getColumn(0).setPreferredWidth(10);//tem ent
            jt_foliosdetalle.getColumnModel().getColumn(1).setPreferredWidth(60);//Familia
            jt_foliosdetalle.getColumnModel().getColumn(2).setPreferredWidth(50);//Subfamilia
            jt_foliosdetalle.getColumnModel().getColumn(3).setPreferredWidth(80);//Clave
            jt_foliosdetalle.getColumnModel().getColumn(4).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(5).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(6).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(7).setPreferredWidth(60);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(8).setPreferredWidth(50);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(9).setPreferredWidth(80);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(10).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(11).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(12).setPreferredWidth(10);//Descripcion
            jt_foliosdetalle.getColumnModel().getColumn(13).setPreferredWidth(60);//Descripcion


        this.id_tienda.setText(String.valueOf(variables_global.getidtiendami()));
        this.id_tienda1.setText(variables_global.getcliente_tistribucion());
        opcionope=opcion;
        if(opcionope==2)
            {
                this.jtf_codigo1.setEditable(false);
                this.jTabbedPane1.setSelectedIndex(1);
                this.jtf_cantidad.selectAll();
                this.jtf_cantidad.requestFocus();
            }
            this.loadcombo();
            controlcombo=1;
    }
private void iniciar_modelo_movimientoextra()
    {
        jtable_modelo_moviextra=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_moviextra.addColumn("<html><b>id O.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Clave O.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Codigo O.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Descripcion O.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Precio O.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Exi.O.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>id D.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Clave D.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Codigo D.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Descripcion D.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Precio D.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Exi. D.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Can.</b></html>");
        jtable_modelo_moviextra.addColumn("<html><b>Razon</b></html>");

   }
private void iniciar_modelo_movimientoextrabaja()
    {
        jtable_modelo_moviextrab=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_moviextrab.addColumn("<html><b>id O.</b></html>");
        jtable_modelo_moviextrab.addColumn("<html><b>Clave O.</b></html>");
        jtable_modelo_moviextrab.addColumn("<html><b>Codigo O.</b></html>");
        jtable_modelo_moviextrab.addColumn("<html><b>Descripcion O.</b></html>");
        jtable_modelo_moviextrab.addColumn("<html><b>Precio O.</b></html>");
        jtable_modelo_moviextrab.addColumn("<html><b>Exi.O.</b></html>");
        jtable_modelo_moviextrab.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_moviextrab.addColumn("<html><b>Razon</b></html>");

   }
private void iniciar_modelo_de_sobrante()
    {
        jtable_modelo_sobrante=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_sobrante.addColumn("<html><b>Codigo.</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>Nombre</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>P. Unitario</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>Desc.</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>Total.</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>Idc.</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>Idd.</b></html>");
        jtable_modelo_sobrante.addColumn("<html><b>tipo.</b></html>");
    }
    private void iniciar_modelo_de_faltante()
    {
        jtable_modelo_faltante=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_faltante.addColumn("<html><b>Codigo.</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>Nombre</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>P. Unitario</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>Desc.</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>Total.</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>Idc.</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>Idd.</b></html>");
        jtable_modelo_faltante.addColumn("<html><b>tipo.</b></html>");
    }
 private void loadcombo()
    {
        System.out.println("id Familia:");
        if (variables_global.getnivelusu()==3)
            {
                this.jcbx_tiendas.addItem(variables_global.getidtiendami()+":"+variables_global.getidtiendami()+":"+variables_global.getcliente_tistribucion());
            }
        else
        {
        this.jcbx_tiendas.addItem("0:Elegir Tienda:0");
        try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_tiendas_activas(9,'','') as (tie_descri character varying(35),tie_id integer,tie_desesque character varying(25),idclie character varying(12));",variables_global.getconexiongral());
               while (rs.next())
                    {
                          this.jcbx_tiendas.addItem(rs.getString("tie_id")+":"+rs.getString("tie_descri")+":"+rs.getString("idclie"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
        }
    }
    private void carga_datos_articulo(int opcion,String codigo,String tienda,String cantidad)
        {
            String texto="select * from x1sieuno_articulo_detalle_ventasacumv2(10,"+tienda+",'"+codigo+"','','') as (ida integer,min integer,max integer,exi double precision,idp integer,cod text,cndt integer,descor text,preve double precision,pre_re real,clavepro text,item text,precioma real,ultimo_costo numeric)",codigoactual="";
            System.out.println(texto);
            String despartido[]=null;
            Object[] fnewRow = new Object[15];
            int encontrado=1,encon=0;
            float cantidadanterior=0,cantidadactual=0;
            DecimalFormat myForma = new DecimalFormat("############.####");
            try
               {
               rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                        encon=1;
                            if(opcion==1)
                                {
                                    cantidadactual=Float.valueOf(cantidad);
                                    for(int ii=0;ii<this.jtable_modelo_moviextra.getRowCount();ii++)
                                        {
                                            codigoactual=jtable_modelo_moviextra.getValueAt(ii, 2).toString();
                                            if (codigo.equals(codigoactual))
                                                {
                                                    encontrado=1;
                                                    cantidadanterior+=Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 12).toString());
                                                    cantidadactual=cantidadanterior+Float.valueOf(cantidad);
                                                }
                                        }

                                    System.out.println("cantidad"+cantidad+" anterior"+cantidadactual+" existencia"+rs.getString("exi"));
                                    if(cantidadactual<=rs.getFloat("exi"))
                                    {
                                        this.jtf_ids.setText(rs.getString("idp"));
                                        this.jtf_claveob.setText(rs.getString("clavepro"));
                                        this.jtf_ultimoprecio1.setText(rs.getString("cod"));
                                        this.jft_ultimodescripcion.setText(rs.getString("descor"));
                                        this.jtf_ultimoprecio.setText(rs.getString("preve"));
                                        this.jtf_oriexi.setText(rs.getString("exi"));
                                        as=1;
                                        if(opcionope==1)
                                            {
                                                        this.jtf_codigo1.selectAll();
                                                        this.jtf_codigo1.requestFocus();
                                            }

                                    }
                                    else
                                        {
                                                //this.jtf_razon.requestFocus();
                                                //this.jtf_razon.selectAll();
                                                as=0;
                                                JOptionPane.showMessageDialog(null," la cantidad Solicitada es Mayor que la existencia!! ", "Sistema Integral(Movimientos al Inventario) : Error",1);
                                                this.jtf_codigo.selectAll();
                                                this.jtf_codigo.requestFocus();

                                        }
                                }
                            if(opcion==2)
                                {
                                     this.jtf_idd.setText(rs.getString("idp"));
                                     this.jtf_claveod.setText(rs.getString("clavepro"));
                                     this.jtf_ultimoprecio2.setText(rs.getString("cod"));
                                     this.jft_ultimodescripcion1.setText(rs.getString("descor"));
                                     this.jtf_ultimoprecio3.setText(rs.getString("preve"));
                                     this.jtf_desexi.setText(rs.getString("exi"));
                                     ad=1;
                                }
                                 if(opcion==3)
                                {
                                    cantidadactual=Float.valueOf(cantidad);
                                    for(int ii=0;ii<this.jtable_modelo_moviextrab.getRowCount();ii++)
                                        {
                                            codigoactual=jtable_modelo_moviextrab.getValueAt(ii, 2).toString();
                                            if (codigo.equals(codigoactual))
                                                {
                                                    encontrado=1;
                                                    cantidadanterior+=Float.valueOf(jtable_modelo_moviextrab.getValueAt(ii, 6).toString());
                                                    cantidadactual=cantidadanterior+Float.valueOf(cantidad);
                                                    System.out.println("baja cantidad:"+cantidadactual+" anterior:"+cantidadanterior+" existencia:"+rs.getString("exi"));
                                                }
                                        }

                                    System.out.println("baja cantidad:"+cantidad+" anterior:"+cantidadactual+" existencia:"+rs.getString("exi"));
                                    if(cantidadactual<=rs.getFloat("exi"))
                                    {
                                        this.jtf_ids.setText(rs.getString("idp"));
                                        this.jtf_claveob.setText(rs.getString("clavepro"));
                                        this.jtf_ultimoprecio1.setText(rs.getString("cod"));
                                        this.jft_ultimodescripcion.setText(rs.getString("descor"));
                                        this.jtf_ultimoprecio.setText(rs.getString("preve"));
                                        this.jtf_oriexi.setText(rs.getString("exi"));
                                        as=1;
                                    }
                                    else
                                        {
                                                //this.jtf_razon.requestFocus();
                                                //this.jtf_razon.selectAll();
                                                as=0;
                                                JOptionPane.showMessageDialog(null," la cantidad Solicitada es Mayor que la existencia!! ", "Sistema Integral(Movimientos al Inventario) : Error",1);
                                                this.jtf_codigo1.selectAll();
                                                this.jtf_codigo1.requestFocus();
                                        }
                                }
                    }
                }
            catch(Exception e)
                {
                    System.out.println(e.getMessage());
                }
            if((opcion==3)||(opcion==1))
             {
                if(encon==0)
                    {
                        JOptionPane.showMessageDialog(null," Articulo "+this.jtf_codigo.getText()+"no Encontrado!!", "Sistema Integral(Movimientos al Inventario) : Error",1);
                        this.jtf_codigo.selectAll();
                        this.jtf_codigo.requestFocus();
                    }
            }
             if(opcion==2)
             {
             if(encon==0)
                    {
                        JOptionPane.showMessageDialog(null," Articulo "+this.jtf_codigo.getText()+"no Encontrado!!", "Sistema Integral(Movimientos al Inventario) : Error",1);
                        this.jtf_codigo1.selectAll();
                        this.jtf_codigo1.requestFocus();
                    }
            }
        }

        private String fechaamericana(Date fe) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;
    }

private void calcularimportes()
    {
    DecimalFormat miformat = new DecimalFormat("############.##");
    int numerofilas=this.jtable_modelo_moviextra.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,costo2=0,importefila=0,importefila2=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,pzdif=0,pzdifc=0,pzdifa=0;
    for(int i = 0 ;i < numerofilas; i++)
        {
            try
                       {
                            cantidad = Float.valueOf(this.jt_foliosdetalle.getValueAt(i, 12).toString()).floatValue();
                            costo = Float.valueOf(this.jt_foliosdetalle.getValueAt(i, 4).toString()).floatValue();
                            costo2 = Float.valueOf(this.jt_foliosdetalle.getValueAt(i, 10).toString()).floatValue();
                            piezasindi+=cantidad;

                            importefila+=(cantidad*costo);
                            importefila2+=(cantidad*costo2);
                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }

                }

    this.jtf_importesob.setText(miformat.format(importefila));
    this.jtf_importefal.setText(miformat.format(importefila2));

    this.jtf_doctoprecio.setText(miformat.format(importefila));
    this.jtf_doctoprecio1.setText(miformat.format(importefila2));

    this.jtf_piezas.setText(miformat.format(piezasindi));

    }
private void calcularimportesbaja()
    {
    DecimalFormat miformat = new DecimalFormat("############.##");
    int numerofilas=this.jtable_modelo_moviextrab.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,costo2=0,importefila=0,importefila2=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,pzdif=0,pzdifc=0,pzdifa=0;
    for(int i = 0 ;i < numerofilas; i++)
        {
            try
                       {
                            cantidad = Float.valueOf(this.jt_foliosdetalle1.getValueAt(i, 6).toString()).floatValue();
                            costo = Float.valueOf(this.jt_foliosdetalle1.getValueAt(i, 4).toString()).floatValue();
                            piezasindi+=cantidad;
                            importefila+=(cantidad*costo);
                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }

                }

    this.jtf_doctoprecio2.setText(miformat.format(importefila));


    this.jtf_piezas1.setText(miformat.format(piezasindi));

    }
private void generar_movext(int opcion)
    {
    int encontrado=0,ii=0,encontradod=0,i=0;
    String codigo="",canti="";
    if(opcion==1)
    {
        for(i = 0 ;i < this.jtable_modelo_moviextra.getRowCount(); i++)
            {
                String codigoactual="";
                codigo=jtable_modelo_moviextra.getValueAt(i, 1).toString();
                canti=jtable_modelo_moviextra.getValueAt(i, 12).toString();
                encontrado=0;
                encontradod=0;
                float cantidadanterior=0,cantidadactual=0,cantidadanteriord=0;

                                for(ii=0;ii<this.jtable_modelo_faltante.getRowCount();ii++)
                                    {
                                        codigoactual=jtable_modelo_faltante.getValueAt(ii, 0).toString();
                                        if (codigo.equals(codigoactual))
                                            {
                                                encontrado=1;
                                                //cantidadanterior=Float.valueOf(jtable_modelo_faltante.getValueAt(ii, 1).toString())-Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 12).toString());
                                                cantidadactual=Float.valueOf(jtable_modelo_faltante.getValueAt(ii, 1).toString())+Float.valueOf(canti);
                                                jtable_modelo_faltante.setValueAt(cantidadactual, ii, 1);
                                            }
                                    }
                                codigo=jtable_modelo_moviextra.getValueAt(i, 7).toString();
                                for(ii=0;ii<this.jtable_modelo_sobrante.getRowCount();ii++)
                                    {
                                        codigoactual=jtable_modelo_sobrante.getValueAt(ii, 0).toString();
                                        if (codigo.equals(codigoactual))
                                            {
                                                encontradod=1;
                                                //cantidadanteriord=Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 11).toString())+Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 12).toString());
                                                cantidadactual=Float.valueOf(jtable_modelo_sobrante.getValueAt(ii, 1).toString())+Float.valueOf(canti);
                                                jtable_modelo_sobrante.setValueAt(cantidadactual, ii, 1);
                                            }
                                    }
                if(encontrado==0)
                    {
                        jtable_modelo_faltante.addRow(new Object[]{jtable_modelo_moviextra.getValueAt(i, 1).toString(),jtable_modelo_moviextra.getValueAt(i, 12).toString(),jtable_modelo_moviextra.getValueAt(i, 3).toString(),jtable_modelo_moviextra.getValueAt(i, 4).toString(),"0",Float.valueOf(canti)*Float.valueOf(jtable_modelo_moviextra.getValueAt(i, 4).toString()),"0","0","1"});
                    }
                if(encontradod==0)
                    {
                        jtable_modelo_sobrante.addRow(new Object[]{jtable_modelo_moviextra.getValueAt(i, 7).toString(),jtable_modelo_moviextra.getValueAt(i, 12).toString(),jtable_modelo_moviextra.getValueAt(i, 9).toString(),jtable_modelo_moviextra.getValueAt(i, 10).toString(),"0",Float.valueOf(canti)*Float.valueOf(jtable_modelo_moviextra.getValueAt(i, 10).toString()),"0","0","1"});
                    }


            }
        }
    }
private String  fechaeuropea(Date fecha) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fecha);
       return cadenafecha;
    }
private void imprimir(int pag,float ptotal)
    {

     java.util.Date fechahoya=new Date();

     this.objimpresora=new articulos_sie_almacen_movi_imprimir();
    System.out.println("bloque:"+pag+" "+ptotal+" Evaluando impresion");
     this.objimpresora.setOneItem_cadenas_a_imprimir("            Id-Rep:S.I.: Solicitud de Reclasificacion de Articulos");
     //this.objimpresora.setOneItem_cadenas_a_imprimir("Fecha:"+this.+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Tienda:"+this.id_tienda.getText()+"     Descripcion:"+this.id_tienda1.getText());
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Folio:"+ this.jtf_idfolio.getText()+"  Fecha Documento:"+this.fechaeuropea(this.jdc_fechadocto.getDate()));
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Observaciones:"+this.jtf_doctoobser.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Folio de Movimiento Extra de Entrada:"+this.jtf_idmovee.getText()+" Folio de Movimiento Extra de Salida:"+this.jtf_idmoves.getText());
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     //this.objimpresora.setOneItem_cadenas_a_imprimir("paginas:"+ pag + " de "+ptotal+"");
     System.out.println("bloque:"+pag+" "+ptotal+" Evaluando impresion");
     if((pag+1)>=ptotal)
        {
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Total Piezas: "+this.jtf_piezas.getText());
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Precio Salida: "+this.jtf_doctoprecio.getText());
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Precio Entrada: "+this.jtf_doctoprecio1.getText());
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Solicita                                       Vo.Bo                                        Aplica");
        this.objimpresora.setOneItem_cadenas_a_imprimir("          ____________________              _______________________              ________________________");
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Gerente Tienda                             Supervisor                                 Area Sistemas");
        this.objimpresora.setOneItem_cadenas_a_imprimir("..");
        }
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Pagina: "+(pag+1)+" de"+ptotal);
     this.objimpresora.setOneItem_cadenas_a_imprimir("         ETAPA 1 DE 2.");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");

     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setObjeto_tabla(jt_foliosdetalle);
     this.objimpresora.imprimir_all(1,pag);
    }
private void imprimir_defectuoso(int pag,float ptotal)
    {

     java.util.Date fechahoya=new Date();

     this.objimpresora=new articulos_sie_almacen_movi_imprimir();
    System.out.println("bloque:"+pag+" "+ptotal+" Evaluando impresion");
     this.objimpresora.setOneItem_cadenas_a_imprimir("            Id-Rep:                S.I.:Solicitud Baja de Articulos por Defectuoso");
     //this.objimpresora.setOneItem_cadenas_a_imprimir("Fecha:"+this.+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Tienda:"+this.id_tienda.getText()+"     Descripcion:"+this.id_tienda1.getText());
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Folio:"+ this.jtf_idfolio.getText()+"  Fecha Documento:"+this.fechaeuropea(this.jdc_fechadocto.getDate()));
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Observaciones:"+this.jtf_doctoobser.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Folio de Movimiento Extra de Salida:"+this.jtf_idmoves.getText());
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     //this.objimpresora.setOneItem_cadenas_a_imprimir("paginas:"+ pag + " de "+ptotal+"");
     System.out.println("bloque:"+pag+" "+ptotal+" Evaluando impresion");
     if((pag+1)>=ptotal)
        {
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Total Piezas: "+this.jtf_piezas1.getText());
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Precio Salida: "+this.jtf_doctoprecio2.getText());

        this.objimpresora.setOneItem_cadenas_a_imprimir("          Solicita                                       Vo.Bo                                        Aplica");
        this.objimpresora.setOneItem_cadenas_a_imprimir("          _______________________                _______________________              ________________________");
        this.objimpresora.setOneItem_cadenas_a_imprimir("          Gerente Tienda                             Supervisor                                 Area Sistemas");
        this.objimpresora.setOneItem_cadenas_a_imprimir("..");
        }
     this.objimpresora.setOneItem_cadenas_a_imprimir("          Pagina: "+(pag+1)+" de"+ptotal);
      this.objimpresora.setOneItem_cadenas_a_imprimir("         ETAPA 1 DE 2.");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");

     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setObjeto_tabla(jt_foliosdetalle1);
     this.objimpresora.imprimir_all(2,pag);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jtf_codigo = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jtf_codigo1 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jft_ultimodescripcion = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jtf_ultimoprecio = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jtf_ultimoprecio1 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jtf_ultimoprecio2 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jft_ultimodescripcion1 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jtf_ultimoprecio3 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jtf_razon = new javax.swing.JTextField();
        jbtn_agregarmov = new javax.swing.JButton();
        jbtn_buscar = new javax.swing.JButton();
        jbtn_buscar1 = new javax.swing.JButton();
        jtf_claves = new javax.swing.JTextField();
        jtf_claved = new javax.swing.JTextField();
        jtf_ids = new javax.swing.JTextField();
        jtf_idd = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jtf_cantidad = new javax.swing.JTextField();
        jtf_oriexi = new javax.swing.JTextField();
        jtf_desexi = new javax.swing.JTextField();
        jtf_claveob = new javax.swing.JTextField();
        jtf_claveod = new javax.swing.JTextField();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_foliosdetalle = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {

                return false;

            }
        }
        ;
        jbtn_guardar = new javax.swing.JButton();
        jtf_piezas = new javax.swing.JTextField();
        jtf_doctoprecio = new javax.swing.JTextField();
        jtf_doctocosto = new javax.swing.JTextField();
        jtf_doctocosto1 = new javax.swing.JTextField();
        jtf_doctoprecio1 = new javax.swing.JTextField();
        jchbx_eliminarfila = new javax.swing.JCheckBox();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jt_foliosdetalle1 = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {

                return false;

            }
        }
        ;
        jtf_piezas1 = new javax.swing.JTextField();
        jtf_doctocosto2 = new javax.swing.JTextField();
        jtf_doctoprecio2 = new javax.swing.JTextField();
        jbtn_guardar1 = new javax.swing.JButton();
        jchbx_eliminarfila1 = new javax.swing.JCheckBox();
        jPanel3 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        jt_sobrantes = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                if (mColIndex < 6)
                return false;
                else
                return true;
            }
        }
        ;
        jLabel26 = new javax.swing.JLabel();
        jtf_importesob = new javax.swing.JTextField();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        jt_faltantes = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                if (mColIndex < 6)
                return false;
                else
                return true;
            }
        }
        ;
        jLabel27 = new javax.swing.JLabel();
        jtf_importefal = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jdc_fechadocto = new com.toedter.calendar.JDateChooser();
        id_tienda = new javax.swing.JTextField();
        jtf_doctoobser = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        id_tienda1 = new javax.swing.JTextField();
        jtf_idmovee = new javax.swing.JTextField();
        jtf_idmoves = new javax.swing.JTextField();
        jtf_idfolio = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jcbx_tiendas = new javax.swing.JComboBox();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jtf_escape = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(articulos_sie_almacen_movi_reclasifalta.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jtf_codigo.setToolTipText(resourceMap.getString("jtf_codigo.toolTipText")); // NOI18N
        jtf_codigo.setName("jtf_codigo"); // NOI18N
        jtf_codigo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_codigoActionPerformed(evt);
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jtf_codigo1.setToolTipText(resourceMap.getString("jtf_codigo1.toolTipText")); // NOI18N
        jtf_codigo1.setName("jtf_codigo1"); // NOI18N
        jtf_codigo1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_codigo1ActionPerformed(evt);
            }
        });

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jft_ultimodescripcion.setEditable(false);
        jft_ultimodescripcion.setFont(resourceMap.getFont("jft_ultimodescripcion.font")); // NOI18N
        jft_ultimodescripcion.setName("jft_ultimodescripcion"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jtf_ultimoprecio.setEditable(false);
        jtf_ultimoprecio.setFont(resourceMap.getFont("jtf_ultimoprecio.font")); // NOI18N
        jtf_ultimoprecio.setName("jtf_ultimoprecio"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jtf_ultimoprecio1.setEditable(false);
        jtf_ultimoprecio1.setFont(resourceMap.getFont("jtf_ultimoprecio1.font")); // NOI18N
        jtf_ultimoprecio1.setName("jtf_ultimoprecio1"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jtf_ultimoprecio2.setEditable(false);
        jtf_ultimoprecio2.setFont(resourceMap.getFont("jtf_ultimoprecio2.font")); // NOI18N
        jtf_ultimoprecio2.setName("jtf_ultimoprecio2"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jft_ultimodescripcion1.setEditable(false);
        jft_ultimodescripcion1.setFont(resourceMap.getFont("jft_ultimodescripcion1.font")); // NOI18N
        jft_ultimodescripcion1.setName("jft_ultimodescripcion1"); // NOI18N

        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jtf_ultimoprecio3.setEditable(false);
        jtf_ultimoprecio3.setFont(resourceMap.getFont("jtf_ultimoprecio3.font")); // NOI18N
        jtf_ultimoprecio3.setName("jtf_ultimoprecio3"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jtf_razon.setToolTipText(resourceMap.getString("jtf_razon.toolTipText")); // NOI18N
        jtf_razon.setName("jtf_razon"); // NOI18N
        jtf_razon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_razonActionPerformed(evt);
            }
        });

        jbtn_agregarmov.setIcon(resourceMap.getIcon("jbtn_agregarmov.icon")); // NOI18N
        jbtn_agregarmov.setText(resourceMap.getString("jbtn_agregarmov.text")); // NOI18N
        jbtn_agregarmov.setName("jbtn_agregarmov"); // NOI18N
        jbtn_agregarmov.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_agregarmovActionPerformed(evt);
            }
        });

        jbtn_buscar.setIcon(resourceMap.getIcon("jbtn_buscar.icon")); // NOI18N
        jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
        jbtn_buscar.setName("jbtn_buscar"); // NOI18N
        jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_buscarActionPerformed(evt);
            }
        });

        jbtn_buscar1.setIcon(resourceMap.getIcon("jbtn_buscar1.icon")); // NOI18N
        jbtn_buscar1.setName("jbtn_buscar1"); // NOI18N
        jbtn_buscar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_buscar1ActionPerformed(evt);
            }
        });

        jtf_claves.setEditable(false);
        jtf_claves.setFont(resourceMap.getFont("jtf_claves.font")); // NOI18N
        jtf_claves.setName("jtf_claves"); // NOI18N

        jtf_claved.setEditable(false);
        jtf_claved.setFont(resourceMap.getFont("jtf_claved.font")); // NOI18N
        jtf_claved.setName("jtf_claved"); // NOI18N

        jtf_ids.setEditable(false);
        jtf_ids.setFont(resourceMap.getFont("jtf_ids.font")); // NOI18N
        jtf_ids.setName("jtf_ids"); // NOI18N

        jtf_idd.setEditable(false);
        jtf_idd.setFont(resourceMap.getFont("jtf_idd.font")); // NOI18N
        jtf_idd.setName("jtf_idd"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jtf_cantidad.setText(resourceMap.getString("jtf_cantidad.text")); // NOI18N
        jtf_cantidad.setToolTipText(resourceMap.getString("jtf_cantidad.toolTipText")); // NOI18N
        jtf_cantidad.setName("jtf_cantidad"); // NOI18N
        jtf_cantidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_cantidadActionPerformed(evt);
            }
        });

        jtf_oriexi.setEditable(false);
        jtf_oriexi.setFont(resourceMap.getFont("jtf_oriexi.font")); // NOI18N
        jtf_oriexi.setName("jtf_oriexi"); // NOI18N

        jtf_desexi.setEditable(false);
        jtf_desexi.setFont(resourceMap.getFont("jtf_desexi.font")); // NOI18N
        jtf_desexi.setName("jtf_desexi"); // NOI18N

        jtf_claveob.setEditable(false);
        jtf_claveob.setFont(resourceMap.getFont("jtf_claveob.font")); // NOI18N
        jtf_claveob.setName("jtf_claveob"); // NOI18N

        jtf_claveod.setEditable(false);
        jtf_claveod.setFont(resourceMap.getFont("jtf_claveod.font")); // NOI18N
        jtf_claveod.setName("jtf_claveod"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_codigo))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_codigo1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jbtn_buscar1, 0, 0, Short.MAX_VALUE)
                            .addComponent(jbtn_buscar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jtf_claveod, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
                            .addComponent(jtf_claveob, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jtf_ultimoprecio2)
                            .addComponent(jtf_ultimoprecio1, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel7)
                            .addComponent(jLabel11))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jft_ultimodescripcion1)
                            .addComponent(jft_ultimodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel12)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jtf_ultimoprecio3, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jtf_ultimoprecio, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_razon, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_claves, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_claved, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(51, 51, 51)
                        .addComponent(jtf_oriexi, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_desexi, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(57, 57, 57)
                        .addComponent(jtf_ids, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_idd, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(758, 758, 758)
                .addComponent(jbtn_agregarmov, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_razon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_claves, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_ids, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_idd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel3)
                    .addComponent(jtf_claved, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_oriexi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_desexi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1)
                            .addComponent(jtf_ultimoprecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jft_ultimodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_ultimoprecio1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8)
                            .addComponent(jtf_claveob, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtf_codigo1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2)
                            .addComponent(jtf_ultimoprecio3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jft_ultimodescripcion1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_ultimoprecio2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)
                            .addComponent(jtf_claveod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(3, 3, 3))
                    .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel10))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jbtn_buscar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtn_buscar1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtn_agregarmov)
                .addGap(26, 26, 26))
        );

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel2.setName("jPanel2"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jt_foliosdetalle.setModel(this.jtable_modelo_moviextra);
        jt_foliosdetalle.setName("jt_foliosdetalle"); // NOI18N
        jt_foliosdetalle.setRowHeight(22);
        // TODO add your handling code here:
        jScrollPane1.setViewportView(jt_foliosdetalle);

        jbtn_guardar.setIcon(resourceMap.getIcon("jbtn_guardar.icon")); // NOI18N
        jbtn_guardar.setText(resourceMap.getString("jbtn_guardar.text")); // NOI18N
        jbtn_guardar.setName("jbtn_guardar"); // NOI18N
        jbtn_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_guardarActionPerformed(evt);
            }
        });

        jtf_piezas.setEditable(false);
        jtf_piezas.setFont(resourceMap.getFont("jtf_piezas.font")); // NOI18N
        jtf_piezas.setText(resourceMap.getString("jtf_piezas.text")); // NOI18N
        jtf_piezas.setName("jtf_piezas"); // NOI18N

        jtf_doctoprecio.setEditable(false);
        jtf_doctoprecio.setFont(resourceMap.getFont("jtf_doctoprecio.font")); // NOI18N
        jtf_doctoprecio.setText(resourceMap.getString("jtf_doctoprecio.text")); // NOI18N
        jtf_doctoprecio.setName("jtf_doctoprecio"); // NOI18N

        jtf_doctocosto.setEditable(false);
        jtf_doctocosto.setFont(resourceMap.getFont("jtf_doctocosto.font")); // NOI18N
        jtf_doctocosto.setText(resourceMap.getString("jtf_doctocosto.text")); // NOI18N
        jtf_doctocosto.setName("jtf_doctocosto"); // NOI18N

        jtf_doctocosto1.setEditable(false);
        jtf_doctocosto1.setFont(resourceMap.getFont("jtf_doctocosto1.font")); // NOI18N
        jtf_doctocosto1.setText(resourceMap.getString("jtf_doctocosto1.text")); // NOI18N
        jtf_doctocosto1.setName("jtf_doctocosto1"); // NOI18N

        jtf_doctoprecio1.setEditable(false);
        jtf_doctoprecio1.setFont(resourceMap.getFont("jtf_doctoprecio1.font")); // NOI18N
        jtf_doctoprecio1.setText(resourceMap.getString("jtf_doctoprecio1.text")); // NOI18N
        jtf_doctoprecio1.setName("jtf_doctoprecio1"); // NOI18N

        jchbx_eliminarfila.setText(resourceMap.getString("jchbx_eliminarfila.text")); // NOI18N
        jchbx_eliminarfila.setName("jchbx_eliminarfila"); // NOI18N
        jchbx_eliminarfila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbx_eliminarfilaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jchbx_eliminarfila)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
                .addComponent(jtf_piezas, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_doctocosto, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_doctoprecio, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(117, 117, 117)
                .addComponent(jtf_doctocosto1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_doctoprecio1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(jbtn_guardar)
                .addGap(22, 22, 22))
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 905, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtn_guardar)
                    .addComponent(jtf_doctoprecio1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_doctocosto1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_doctoprecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_doctocosto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_piezas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jchbx_eliminarfila))
                .addContainerGap())
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

        jPanel5.setName("jPanel5"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jt_foliosdetalle1.setModel(this.jtable_modelo_moviextrab);
        jt_foliosdetalle1.setName("jt_foliosdetalle1"); // NOI18N
        jt_foliosdetalle1.setRowHeight(22);
        // TODO add your handling code here:
        jScrollPane2.setViewportView(jt_foliosdetalle1);

        jtf_piezas1.setEditable(false);
        jtf_piezas1.setFont(resourceMap.getFont("jtf_piezas1.font")); // NOI18N
        jtf_piezas1.setText(resourceMap.getString("jtf_piezas1.text")); // NOI18N
        jtf_piezas1.setName("jtf_piezas1"); // NOI18N

        jtf_doctocosto2.setEditable(false);
        jtf_doctocosto2.setFont(resourceMap.getFont("jtf_doctocosto2.font")); // NOI18N
        jtf_doctocosto2.setText(resourceMap.getString("jtf_doctocosto2.text")); // NOI18N
        jtf_doctocosto2.setName("jtf_doctocosto2"); // NOI18N

        jtf_doctoprecio2.setEditable(false);
        jtf_doctoprecio2.setFont(resourceMap.getFont("jtf_doctoprecio2.font")); // NOI18N
        jtf_doctoprecio2.setText(resourceMap.getString("jtf_doctoprecio2.text")); // NOI18N
        jtf_doctoprecio2.setName("jtf_doctoprecio2"); // NOI18N

        jbtn_guardar1.setIcon(resourceMap.getIcon("jbtn_guardar1.icon")); // NOI18N
        jbtn_guardar1.setText(resourceMap.getString("jbtn_guardar1.text")); // NOI18N
        jbtn_guardar1.setName("jbtn_guardar1"); // NOI18N
        jbtn_guardar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_guardar1ActionPerformed(evt);
            }
        });

        jchbx_eliminarfila1.setText(resourceMap.getString("jchbx_eliminarfila1.text")); // NOI18N
        jchbx_eliminarfila1.setName("jchbx_eliminarfila1"); // NOI18N
        jchbx_eliminarfila1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbx_eliminarfila1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(jchbx_eliminarfila1)
                .addGap(81, 81, 81)
                .addComponent(jtf_piezas1, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47)
                .addComponent(jtf_doctocosto2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_doctoprecio2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(278, 278, 278)
                .addComponent(jbtn_guardar1)
                .addGap(55, 55, 55))
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 905, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtn_guardar1)
                    .addComponent(jtf_doctoprecio2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_doctocosto2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_piezas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jchbx_eliminarfila1))
                .addContainerGap())
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel10.border.title"))); // NOI18N
        jPanel10.setName("jPanel10"); // NOI18N

        jScrollPane8.setName("jScrollPane8"); // NOI18N

        jt_sobrantes.setModel(this.jtable_modelo_sobrante);
        jt_sobrantes.setName("jt_sobrantes"); // NOI18N
        // TODO add your handling code here:
        jScrollPane8.setViewportView(jt_sobrantes);

        jLabel26.setText(resourceMap.getString("jLabel26.text")); // NOI18N
        jLabel26.setName("jLabel26"); // NOI18N

        jtf_importesob.setEditable(false);
        jtf_importesob.setText(resourceMap.getString("jtf_importesob.text")); // NOI18N
        jtf_importesob.setName("jtf_importesob"); // NOI18N

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_importesob, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(7, 7, 7)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(jtf_importesob, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel9.border.title"))); // NOI18N
        jPanel9.setName("jPanel9"); // NOI18N

        jScrollPane9.setName("jScrollPane9"); // NOI18N

        jt_faltantes.setModel(this.jtable_modelo_faltante);
        jt_faltantes.setName("jt_faltantes"); // NOI18N
        // TODO add your handling code here:
        jScrollPane9.setViewportView(jt_faltantes);

        jLabel27.setText(resourceMap.getString("jLabel27.text")); // NOI18N
        jLabel27.setName("jLabel27"); // NOI18N

        jtf_importefal.setEditable(false);
        jtf_importefal.setText(resourceMap.getString("jtf_importefal.text")); // NOI18N
        jtf_importefal.setName("jtf_importefal"); // NOI18N

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel27)
                .addGap(18, 18, 18)
                .addComponent(jtf_importefal, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(236, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_importefal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27)))
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE))
                .addContainerGap(133, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N

        jPanel4.setName("jPanel4"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jdc_fechadocto.setDateFormatString(resourceMap.getString("jdc_fechadocto.dateFormatString")); // NOI18N
        jdc_fechadocto.setEnabled(false);
        jdc_fechadocto.setName("jdc_fechadocto"); // NOI18N

        id_tienda.setEditable(false);
        id_tienda.setFont(resourceMap.getFont("id_tienda.font")); // NOI18N
        id_tienda.setText(resourceMap.getString("id_tienda.text")); // NOI18N
        id_tienda.setName("id_tienda"); // NOI18N

        jtf_doctoobser.setText(resourceMap.getString("jtf_doctoobser.text")); // NOI18N
        jtf_doctoobser.setToolTipText(resourceMap.getString("jtf_doctoobser.toolTipText")); // NOI18N
        jtf_doctoobser.setName("jtf_doctoobser"); // NOI18N
        jtf_doctoobser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_doctoobserActionPerformed(evt);
            }
        });

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        id_tienda1.setEditable(false);
        id_tienda1.setFont(resourceMap.getFont("id_tienda1.font")); // NOI18N
        id_tienda1.setText(resourceMap.getString("id_tienda1.text")); // NOI18N
        id_tienda1.setName("id_tienda1"); // NOI18N

        jtf_idmovee.setEditable(false);
        jtf_idmovee.setFont(resourceMap.getFont("jtf_idmovee.font")); // NOI18N
        jtf_idmovee.setName("jtf_idmovee"); // NOI18N

        jtf_idmoves.setEditable(false);
        jtf_idmoves.setFont(resourceMap.getFont("jtf_idmoves.font")); // NOI18N
        jtf_idmoves.setName("jtf_idmoves"); // NOI18N

        jtf_idfolio.setEditable(false);
        jtf_idfolio.setFont(resourceMap.getFont("jtf_idfolio.font")); // NOI18N
        jtf_idfolio.setName("jtf_idfolio"); // NOI18N

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jcbx_tiendas.setToolTipText(resourceMap.getString("jcbx_tiendas.toolTipText")); // NOI18N
        jcbx_tiendas.setName("jcbx_tiendas"); // NOI18N
        jcbx_tiendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_tiendasActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(id_tienda, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(id_tienda1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 147, Short.MAX_VALUE)
                .addComponent(jtf_idfolio, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jtf_idmovee, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_idmoves, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(208, 208, 208))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_doctoobser, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(524, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(id_tienda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(id_tienda1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel13)
                        .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_doctoobser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_idmovee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_idmoves, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_idfolio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jtf_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jtf_escape.setText(resourceMap.getString("jtf_escape.text")); // NOI18N
        jtf_escape.setName("jtf_escape"); // NOI18N
        jtf_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jtf_escape);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 910, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jtf_codigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_codigoActionPerformed
        // TODO add your handling code here:


this.jbtn_buscarActionPerformed(evt);
if(opcionope==2)
    {
        this.jbtn_agregarmovActionPerformed(evt);
    }
//else
//    {
//        this.jtf_codigo1.requestFocus();
//        this.jtf_codigo1.selectAll();
//   }
}//GEN-LAST:event_jtf_codigoActionPerformed

    private void jtf_codigo1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_codigo1ActionPerformed
        // TODO add your handling code here:

        this.jbtn_buscar1ActionPerformed(evt);
        this.jbtn_agregarmovActionPerformed(evt);


    }//GEN-LAST:event_jtf_codigo1ActionPerformed

    private void jtf_razonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_razonActionPerformed
        // TODO add your handling code here:
        this.jtf_codigo.requestFocus();
        this.jtf_codigo.selectAll();
}//GEN-LAST:event_jtf_razonActionPerformed

    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
if(opcionope==1)
    {
        this.carga_datos_articulo(1, this.jtf_codigo.getText().trim().toUpperCase(),this.id_tienda.getText(),this.jtf_cantidad.getText());
    }
if(opcionope==2)
    {
        this.carga_datos_articulo(3, this.jtf_codigo.getText().trim().toUpperCase(),this.id_tienda.getText(),this.jtf_cantidad.getText());
    }
}//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jbtn_buscar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscar1ActionPerformed
        // TODO add your handling code here:
     this.carga_datos_articulo(2, this.jtf_codigo1.getText().trim().toUpperCase(),this.id_tienda.getText(),this.jtf_cantidad.getText());
    }//GEN-LAST:event_jbtn_buscar1ActionPerformed

    private void jtf_cantidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_cantidadActionPerformed
        // TODO add your handling code here:
        this.jtf_razon.requestFocus();
        this.jtf_razon.selectAll();
}//GEN-LAST:event_jtf_cantidadActionPerformed

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0) {
             this.dispose();
        }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jbtn_agregarmovActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregarmovActionPerformed
        // TODO add your handling code here:

        if(opcionope==1)
        {
            if((as==1) && (ad==1))
            {
            if(JOptionPane.showConfirmDialog(null, "<html><h2>Cantidad:"+this.jtf_cantidad.getText()+"<br>razon :"+this.jtf_razon.getText()+"<br> Clave Origen:"+this.jtf_claveob.getText()+"<br>Clave Destino:"+this.jtf_claveod.getText()+"<br>Desea Agregar?</h2></html>")==0)
                    {
                    String codigoactual="";
                    String codigo=this.jtf_claveob.getText();
                    int encontrado=0,ii=0,encontradod=0;
                    float cantidadanterior=0,cantidadactual=0,cantidadanteriord=0;
                Object[] fnewRow = new Object[14];

                                for(ii=0;ii<this.jtable_modelo_moviextra.getRowCount();ii++)
                                    {
                                        codigoactual=jtable_modelo_moviextra.getValueAt(ii, 1).toString();
                                        if (codigo.equals(codigoactual))
                                            {
                                                encontrado=1;
                                                cantidadanterior=Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 5).toString())-Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 12).toString());
                                                cantidadactual=Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 12).toString())+Float.valueOf(this.jtf_cantidad.getText().toString());
                                                //jtable_modelo_faltante.setValueAt(cantidadactual, ii, 1);
                                            }
                                    }
                                codigo=this.jtf_claveod.getText();
                                for(ii=0;ii<this.jtable_modelo_moviextra.getRowCount();ii++)
                                    {
                                        codigoactual=jtable_modelo_moviextra.getValueAt(ii, 7).toString();
                                        if (codigo.equals(codigoactual))
                                            {
                                                encontradod=1;
                                                cantidadanteriord=Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 11).toString())+Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 12).toString());
                                                cantidadactual=Float.valueOf(jtable_modelo_moviextra.getValueAt(ii, 12).toString())+Float.valueOf(this.jtf_cantidad.getText().toString());
                                                //jtable_modelo_sobrante.setValueAt(cantidadactual, ii, 1);
                                            }
                                    }
                fnewRow[0]=this.jtf_ids.getText();
                fnewRow[1]=this.jtf_claveob.getText();
                fnewRow[2]=this.jtf_codigo.getText();
                fnewRow[3]=this.jft_ultimodescripcion.getText();
                fnewRow[4]=this.jtf_ultimoprecio.getText();
                if(encontrado==1)
                    {
                        fnewRow[5]=cantidadanterior;
                    }
                else
                    {
                        fnewRow[5]=this.jtf_oriexi.getText();
                    }


                fnewRow[6]=this.jtf_idd.getText();
                fnewRow[7]=this.jtf_claveod.getText();
                fnewRow[8]=this.jtf_codigo1.getText();
                fnewRow[9]=this.jft_ultimodescripcion1.getText();
                fnewRow[10]=this.jtf_ultimoprecio3.getText();
                 if(encontradod==1)
                    {
                        fnewRow[11]=cantidadanteriord;
                    }
                 else
                    {
                        fnewRow[11]=this.jtf_desexi.getText();
                    }
                fnewRow[12]=this.jtf_cantidad.getText();
                fnewRow[13]=this.jtf_razon.getText()+".";

                jtable_modelo_moviextra.addRow(fnewRow);
                /*if(encontrado==0)
                    {
                        jtable_modelo_faltante.addRow(new Object[]{this.jtf_claveob.getText(),this.jtf_cantidad.getText(),this.jft_ultimodescripcion.getText(),this.jtf_ultimoprecio.getText(),"0",Float.valueOf(this.jtf_cantidad.getText())*Float.valueOf(this.jtf_ultimoprecio.getText()),"0","0","1"});
                    }
                if(encontradod==0)
                    {
                        jtable_modelo_sobrante.addRow(new Object[]{this.jtf_claveod.getText(),this.jtf_cantidad.getText(),this.jft_ultimodescripcion1.getText(),this.jtf_ultimoprecio3.getText(),"0",Float.valueOf(this.jtf_cantidad.getText())*Float.valueOf(this.jtf_ultimoprecio3.getText()),"0","0","1"});
                    }
                */

                this.calcularimportes();
                this.jtf_codigo1.setText("");
                this.jtf_codigo.setText("");

                this.jtf_cantidad.requestFocus();
                this.jtf_cantidad.selectAll();
                as=0;
                ad=0;
                }
            }
            else
                {
            
                }
            }//fin de opcion 1
//esta la opcion para dar de baja
      if(opcionope==2)
        {
            if(as==1)
            {
                if(JOptionPane.showConfirmDialog(null, "<html><h2>Cantidad:"+this.jtf_cantidad.getText()+"<br>razon :"+this.jtf_razon.getText()+"<br> Clave Baja:"+this.jtf_claveob.getText()+"<br>Desea Agregar?</h2></html>")==0)
                    {
                    String codigoactual="";
                    String codigo=this.jtf_claveob.getText();
                    int encontrado=0,ii=0,encontradod=0;
                    float cantidadanterior=0,cantidadactual=0,cantidadanteriord=0;
                    Object[] fnewRow = new Object[14];

                                for(ii=0;ii<this.jtable_modelo_moviextrab.getRowCount();ii++)
                                    {
                                        codigoactual=jtable_modelo_moviextrab.getValueAt(ii, 1).toString();
                                        if (codigo.equals(codigoactual))
                                            {
                                                encontrado=1;
                                                cantidadanterior=Float.valueOf(jtable_modelo_moviextrab.getValueAt(ii, 5).toString())-Float.valueOf(jtable_modelo_moviextrab.getValueAt(ii, 6).toString());
                                                cantidadactual=Float.valueOf(jtable_modelo_moviextrab.getValueAt(ii, 6).toString())+Float.valueOf(this.jtf_cantidad.getText().toString());
                                                //jtable_modelo_faltante.setValueAt(cantidadactual, ii, 1);
                                            }
                                    }

                fnewRow[0]=this.jtf_ids.getText();
                fnewRow[1]=this.jtf_claveob.getText();
                fnewRow[2]=this.jtf_codigo.getText();
                fnewRow[3]=this.jft_ultimodescripcion.getText();
                fnewRow[4]=this.jtf_ultimoprecio.getText();
                if(encontrado==1)
                    {
                        fnewRow[5]=cantidadanterior;
                    }
                else
                    {
                        fnewRow[5]=this.jtf_oriexi.getText();
                    }

                fnewRow[6]=this.jtf_cantidad.getText();
                fnewRow[7]=this.jtf_razon.getText()+".";

                jtable_modelo_moviextrab.addRow(fnewRow);
                
                        jtable_modelo_faltante.addRow(new Object[]{this.jtf_claveob.getText(),this.jtf_cantidad.getText(),this.jft_ultimodescripcion.getText(),this.jtf_ultimoprecio.getText(),"0",Float.valueOf(this.jtf_cantidad.getText())*Float.valueOf(this.jtf_ultimoprecio.getText()),"0","0","1"});
              

                this.calcularimportesbaja();
                this.jtf_codigo.setText("");
                this.jtf_cantidad.requestFocus();
                this.jtf_cantidad.selectAll();
                as=0;

                }
            }
            else
                {

                }
        }
}//GEN-LAST:event_jbtn_agregarmovActionPerformed

    private void jbtn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardarActionPerformed
        // TODO add your handling code here:
 float filas=0,paginas=0;
 int ni=0,find=0;

//if ( (totalpiezas > 0) && (error==0) && (idclientesele>0)) {
if(JOptionPane.showConfirmDialog(null, "<html>Documento de Reclasificacion:<b><br>Piezas<h3>"+this.jtf_piezas.getText()+"</h3></b> sera Guardado. Estan correcto sus Datos?</html>")==0)
            {
            this.generar_movext(1);
                //for(int i = 0 ;i < nobjetotabla; i++) {
                 //   punto=jtable_modelo_doctomovidet.getValueAt(i, 6).toString().replace(".", "")+".";
                  //  jtable_modelo_doctomovidet.setValueAt(punto, i,6);
                //}
                java.util.Vector arreglodearticulos=this.jtable_modelo_moviextra.getDataVector();
                String articulos_papostgresql=arreglodearticulos.toString();
                articulos_papostgresql=articulos_papostgresql.replace('[','{');
                articulos_papostgresql=articulos_papostgresql.replace(']','}');
                articulos_papostgresql=articulos_papostgresql.replace("null",".");

                java.util.Vector arreglodesobrantes=this.jtable_modelo_sobrante.getDataVector();
                String articulos_sobrantes=arreglodesobrantes.toString();
                articulos_sobrantes=articulos_sobrantes.replace('[','{');
                articulos_sobrantes=articulos_sobrantes.replace(']','}');

                java.util.Vector arreglodefaltantes=this.jtable_modelo_faltante.getDataVector();
                String articulos_faltantes=arreglodefaltantes.toString(),textodif="";
                articulos_faltantes=articulos_faltantes.replace('[','{');
                articulos_faltantes=articulos_faltantes.replace(']','}');

                String texto="select * from x1sieuno_articulo_inven_mov_invev2(1,'"+this.id_tienda.getText()+"','"+this.fechaamericana(this.jdc_fechadocto.getDate())+"','Ent. Ajuste Pz Fisicas sistema vs revision promo','Sal. Ajuste Pz Fisicas sistema vs revision promo','"+this.jtf_doctoobser.getText().toUpperCase().replace(",", "")+"','"+variables_global.getId_empleado()+"','"+articulos_papostgresql+"','"+articulos_sobrantes+"','"+articulos_faltantes+"','"+this.jtf_piezas.getText().trim()+"','"+this.jtf_doctocosto.getText().trim()+"',"+this.jtf_doctoprecio.getText()+",'"+this.jtf_doctocosto1.getText().trim()+"',"+this.jtf_doctoprecio1.getText()+")";
                System.out.println(texto);
                try {
                    rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                    while (rs.next()) 
                    {
                        this.jtf_idfolio.setText(rs.getString(1));
                        find=1;
                        
                    }
                } catch(Exception e) {
                    System.out.println(e.getMessage());
                    JOptionPane.showMessageDialog(null," Folio Venta Incorrecto ", "Sistema Integral(Venta Articulos) : Error",1);
                }
                if(find==1)
                    {
                        texto="select * from x1sieuno_articulo_almacen_movextras_vinculados(1,"+this.id_tienda.getText()+",'"+this.jtf_idfolio.getText()+"','','') as (iddoc integer,fecha date,hora time,idemp integer,cantidad numeric,costo numeric,precio numeric,obs text,foliomee integer,foliomes integer)";
                        try
                            {
                            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                            while (rs.next())
                                {
                                    this.jtf_idmovee.setText(rs.getString("foliomee"));
                                    this.jtf_idmoves.setText(rs.getString("foliomes"));
                                }
                            }
                            catch(Exception e)
                                {
                                    System.out.println(e.getMessage());
                                }
                      filas = this.jtable_modelo_moviextra.getRowCount() ;
                                         paginas = filas /50;
                                         for(ni=0;ni<paginas;ni++)
                                                {
                                                this.imprimir(ni, paginas);
                                                }
                            this.dispose();
                    }
                else
                    {
                            JOptionPane.showMessageDialog(null," Error Verifique sus Cantidades", "Sistema Integral(requisicion Insumos) : Error",1);
                    }
            }//fin del if qu confirmo guardar diferencia

       
    }//GEN-LAST:event_jbtn_guardarActionPerformed

    private void jtf_doctoobserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_doctoobserActionPerformed
        // TODO add your handling code here:
        this.jtf_cantidad.requestFocus();
        this.jtf_cantidad.selectAll();
}//GEN-LAST:event_jtf_doctoobserActionPerformed

    private void jtf_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jtf_escapeActionPerformed

    private void jbtn_guardar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardar1ActionPerformed
        // TODO add your handling code here:
 float filas=0,paginas=0;
 int ni=0,find=0;

//if ( (totalpiezas > 0) && (error==0) && (idclientesele>0)) {

if(JOptionPane.showConfirmDialog(null, "<html><h2>Tienda:"+this.id_tienda1.getText()+"<br>Documento de Reclasificacion<b><br>Piezas"+this.jtf_piezas1.getText()+"</b> sera Guardado. Estan correcto sus Datos?<h2></html>")==0)
            {
           
                //for(int i = 0 ;i < nobjetotabla; i++) {
                 //   punto=jtable_modelo_doctomovidet.getValueAt(i, 6).toString().replace(".", "")+".";
                  //  jtable_modelo_doctomovidet.setValueAt(punto, i,6);
                //}
                java.util.Vector arreglodearticulos=this.jtable_modelo_moviextrab.getDataVector();
                String articulos_papostgresql=arreglodearticulos.toString();
                articulos_papostgresql=articulos_papostgresql.replace('[','{');
                articulos_papostgresql=articulos_papostgresql.replace(']','}');
                articulos_papostgresql=articulos_papostgresql.replace("null",".");

                    java.util.Vector arreglodesobrantes=this.jtable_modelo_sobrante.getDataVector();
                    String articulos_sobrantes=arreglodesobrantes.toString();
                    articulos_sobrantes=articulos_sobrantes.replace('[','{');
                    articulos_sobrantes=articulos_sobrantes.replace(']','}');

                     java.util.Vector arreglodefaltantes=this.jtable_modelo_faltante.getDataVector();
                     String articulos_faltantes=arreglodefaltantes.toString(),textodif="";
                     articulos_faltantes=articulos_faltantes.replace('[','{');
                     articulos_faltantes=articulos_faltantes.replace(']','}');

                String texto="select * from x1sieuno_articulo_inven_mov_invev2(2,'"+this.id_tienda.getText()+"','"+this.fechaamericana(this.jdc_fechadocto.getDate())+"','Sal Defectuoso','','"+this.jtf_doctoobser.getText().toUpperCase().replace(",", "")+"','"+variables_global.getId_empleado()+"','"+articulos_papostgresql+"','"+articulos_sobrantes+"','"+articulos_faltantes+"','"+this.jtf_piezas1.getText().trim()+"','"+this.jtf_doctocosto.getText().trim()+"',"+this.jtf_doctoprecio2.getText()+",'"+this.jtf_doctocosto1.getText().trim()+"',"+this.jtf_doctoprecio2.getText()+")";
                System.out.println(texto);
                try {
                    rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                    while (rs.next())
                    {
                        this.jtf_idfolio.setText(rs.getString(1));
                        find=1;

                    }
                } catch(Exception e) {
                    System.out.println(e.getMessage());
                    JOptionPane.showMessageDialog(null," Folio Venta Incorrecto ", "Sistema Integral(Venta Articulos) : Error",1);
                }
                if(find==1)
                    {
                        texto="select * from x1sieuno_articulo_almacen_movextras_vinculados(1,"+this.id_tienda.getText()+",'"+this.jtf_idfolio.getText()+"','','') as (iddoc integer,fecha date,hora time,idemp integer,cantidad numeric,costo numeric,precio numeric,obs text,foliomee integer,foliomes integer)";
                        try
                            {
                            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                            while (rs.next())
                                {
                                    this.jtf_idmovee.setText(rs.getString("foliomee"));
                                    this.jtf_idmoves.setText(rs.getString("foliomes"));
                                }
                            }
                            catch(Exception e)
                                {
                                    System.out.println(e.getMessage());
                                }
                      filas = this.jtable_modelo_moviextrab.getRowCount() ;
                                         paginas = filas /50;
                                         for(ni=0;ni<paginas;ni++)
                                             {
                                                this.imprimir_defectuoso(ni, paginas);
                                             }
                            this.dispose();
                    }
                else
                    {
                            JOptionPane.showMessageDialog(null," Error Verifique sus Cantidades", "Sistema Integral(requisicion Insumos) : Error",1);
                    }
            }//fin del if qu confirmo guardar diferencia
    }//GEN-LAST:event_jbtn_guardar1ActionPerformed

    private void jcbx_tiendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_tiendasActionPerformed
        // TODO add your handling code here:

        if (controlcombo > 0 )
            {
                String arreglo_idtie[]=null;
                arreglo_idtie=this.jcbx_tiendas.getSelectedItem().toString().split(":");
                this.id_tienda.setText(arreglo_idtie[0]);
                this.id_tienda1.setText(arreglo_idtie[1]);
            }

        //this.jtfpruebados.setText(jtable_tiendas.getValueAt(indeceta, 0).toString());
}//GEN-LAST:event_jcbx_tiendasActionPerformed

    private void jchbx_eliminarfilaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbx_eliminarfilaActionPerformed
        // TODO add your handling code here:
        int fila = jt_foliosdetalle.getSelectedRow();

            if(JOptionPane.showConfirmDialog(null, "Desea Eliminar Fila Seleccionada?")==0) {
                jtable_modelo_moviextra.removeRow(fila);
                this.calcularimportes();
            }

    }//GEN-LAST:event_jchbx_eliminarfilaActionPerformed

    private void jchbx_eliminarfila1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbx_eliminarfila1ActionPerformed
        // TODO add your handling code here:
                int fila = jt_foliosdetalle1.getSelectedRow();

            if(JOptionPane.showConfirmDialog(null, "Desea Eliminar Fila Seleccionada?")==0) {
                jtable_modelo_moviextrab.removeRow(fila);
                jtable_modelo_faltante.removeRow(fila);
                this.calcularimportesbaja();
            }
    }//GEN-LAST:event_jchbx_eliminarfila1ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new articulos_sie_almacen_movi_reclasifalta().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField id_tienda;
    private javax.swing.JTextField id_tienda1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtn_agregarmov;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JButton jbtn_buscar1;
    private javax.swing.JButton jbtn_guardar;
    private javax.swing.JButton jbtn_guardar1;
    private javax.swing.JComboBox jcbx_tiendas;
    private javax.swing.JCheckBox jchbx_eliminarfila;
    private javax.swing.JCheckBox jchbx_eliminarfila1;
    private com.toedter.calendar.JDateChooser jdc_fechadocto;
    private javax.swing.JTextField jft_ultimodescripcion;
    private javax.swing.JTextField jft_ultimodescripcion1;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JTable jt_faltantes;
    private javax.swing.JTable jt_foliosdetalle;
    private javax.swing.JTable jt_foliosdetalle1;
    private javax.swing.JTable jt_sobrantes;
    private javax.swing.JTextField jtf_cantidad;
    private javax.swing.JTextField jtf_claved;
    private javax.swing.JTextField jtf_claveob;
    private javax.swing.JTextField jtf_claveod;
    private javax.swing.JTextField jtf_claves;
    private javax.swing.JTextField jtf_codigo;
    private javax.swing.JTextField jtf_codigo1;
    private javax.swing.JTextField jtf_desexi;
    private javax.swing.JTextField jtf_doctocosto;
    private javax.swing.JTextField jtf_doctocosto1;
    private javax.swing.JTextField jtf_doctocosto2;
    private javax.swing.JTextField jtf_doctoobser;
    private javax.swing.JTextField jtf_doctoprecio;
    private javax.swing.JTextField jtf_doctoprecio1;
    private javax.swing.JTextField jtf_doctoprecio2;
    private javax.swing.JMenuItem jtf_escape;
    private javax.swing.JTextField jtf_idd;
    private javax.swing.JTextField jtf_idfolio;
    private javax.swing.JTextField jtf_idmovee;
    private javax.swing.JTextField jtf_idmoves;
    private javax.swing.JTextField jtf_ids;
    private javax.swing.JTextField jtf_importefal;
    private javax.swing.JTextField jtf_importesob;
    private javax.swing.JTextField jtf_oriexi;
    private javax.swing.JTextField jtf_piezas;
    private javax.swing.JTextField jtf_piezas1;
    private javax.swing.JTextField jtf_razon;
    private javax.swing.JTextField jtf_ultimoprecio;
    private javax.swing.JTextField jtf_ultimoprecio1;
    private javax.swing.JTextField jtf_ultimoprecio2;
    private javax.swing.JTextField jtf_ultimoprecio3;
    // End of variables declaration//GEN-END:variables
private articulos_sie_almacen_movi_imprimir objimpresora;
}
